home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_488 / lordofhosts / lohsrc.lzh / display.c < prev    next >
C/C++ Source or Header  |  1991-05-10  |  15KB  |  461 lines

  1. /* LORD OF HOSTS - display.c --- Grafikroutinen */
  2.  
  3. #include "Lord.h"
  4.  
  5. extern struct RastPort   *RP;
  6. extern struct ViewPort   *VP;
  7. extern struct BitMap     *BM,PiecesBM;
  8.  
  9. /* IMAGES - erstellt mit NGI 1.3 */
  10.  
  11. UWORD RKingData[168] = {
  12.     /* BitPlane 0 */
  13.     0x7FFF,0xF000,    0x0000,0x0800,    0x01F8,0x0800,    0x03FC,0x0800,    0x03FC,0x0800,
  14.     0x03FC,0x0800,    0x03FC,0x0800,    0x03FC,0x0800,    0x01F8,0x0800,    0x00F8,0x0800,
  15.     0x0000,0x0800,    0x2040,0x4800,    0x2040,0x8800,    0x2081,0x0800,    0x2082,0x0800,
  16.     0x1104,0x0800,    0x1000,0x0800,    0x0800,0x0800,    0x0FFF,0x8800,    0x0000,0x0800,
  17.     0x0000,0x0000,
  18.     /* BitPlane 1 */
  19.     0xFFFF,0xF800,    0x7F07,0xF800,    0x7FFB,0xF800,    0x7FFD,0xF800,    0x7FFD,0xF800,
  20.     0x7FFD,0xF800,    0x7FFD,0xF800,    0x7FFD,0xF800,    0x7FFB,0xF800,    0x7FFF,0xF800,
  21.     0x7FFF,0xF800,    0x5F9F,0xB800,    0x4F9F,0x3800,    0x470E,0x3800,    0x430C,0x3800,
  22.     0x6000,0x7800,    0x6000,0x7800,    0x7000,0x7800,    0x7000,0x7800,    0x7FFF,0xF800,
  23.     0x8000,0x0800,
  24.     /* BitPlane 2 */
  25.     0x0000,0x0000,    0x80F8,0x0000,    0x80FC,0x0000,    0x81FE,0x0000,    0x81FE,0x0000,
  26.     0x81FE,0x0000,    0x81FE,0x0000,    0x81FE,0x0000,    0x80FC,0x0000,    0x8000,0x0000,
  27.     0xA000,0x2000,    0xB040,0x6000,    0xA850,0xA000,    0xA489,0x2000,    0xA28A,0x2000,
  28.     0x9104,0x4000,    0x9000,0x4000,    0x8800,0x0000,    0x8FFF,0x8000,    0x8000,0x0000,
  29.     0x7FFF,0xF000,
  30.     /* BitPlane 3 */
  31.     0x0000,0x0000,    0x0000,0x0000,    0x00F8,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,
  32.     0x01FC,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,    0x00F8,0x0000,    0x0000,0x0000,
  33.     0x0000,0x0000,    0x0020,0x0000,    0x1020,0x4000,    0x1870,0xC000,    0x1C71,0xC000,
  34.     0x0EFB,0x8000,    0x0FFF,0x8000,    0x07FF,0x8000,    0x0000,0x0000,    0x0000,0x0000,
  35.     0x0000,0x0000
  36. };
  37.  
  38. UWORD WKingData[168] = {
  39.     /* BitPlane 0 */
  40.     0x8000,0x0800,    0xFFFF,0xF000,    0xF000,0x7000,    0xF000,0x3000,    0xF000,0x3000,
  41.     0xF000,0x3000,    0xE186,0x1000,    0xE387,0x1000,    0xE7CF,0x9000,    0xEFCF,0xD000,
  42.     0xFFFF,0xF000,    0xFFFF,0xF000,    0xFEFF,0xF000,    0xFDFF,0xF000,    0xFDFF,0xF000,
  43.     0xFDFF,0xF000,    0xFDFF,0xF000,    0xFDFF,0xF000,    0xFEFF,0xF000,    0xFF07,0xF000,
  44.     0xFFFF,0xF800,
  45.     /* BitPlane 1 */
  46.     0x7FFF,0xF000,    0x8000,0x0800,    0x8FFF,0x8800,    0x9000,0x4800,    0x9000,0x4800,
  47.     0x9104,0x4800,    0xA28A,0x2800,    0xA489,0x2800,    0xA850,0xA800,    0xB010,0x6800,
  48.     0xA000,0x2800,    0x80F8,0x0800,    0x81FC,0x0800,    0x83FE,0x0800,    0x83FE,0x0800,
  49.     0x83FE,0x0800,    0x83FE,0x0800,    0x83FE,0x0800,    0x81FC,0x0800,    0x80F8,0x0800,
  50.     0x7FFF,0xF000,
  51.     /* BitPlane 2 */
  52.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xF000,0x7800,    0xF000,0x7800,
  53.     0xF104,0x7800,    0xE38E,0x3800,    0xE78F,0x3800,    0xEFDF,0xB800,    0xFF9F,0xF800,
  54.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  55.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  56.     0xFFFF,0xF800,
  57.     /* BitPlane 3 */
  58.     0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0FFF,0x8000,    0x0FFF,0x8000,
  59.     0x0EFB,0x8000,    0x1C71,0xC000,    0x1870,0xC000,    0x1020,0x4000,    0x0020,0x0000,
  60.     0x0000,0x0000,    0x0000,0x0000,    0x00F8,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,
  61.     0x01FC,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,    0x00F8,0x0000,    0x0000,0x0000,
  62.     0x0000,0x0000
  63. };
  64.  
  65. UWORD RKnightData[168] = {
  66.     /* BitPlane 0 */
  67.     0x7FFF,0xF000,    0x0000,0x0800,    0x01F8,0x0800,    0x03FC,0x0800,    0x03FC,0x0800,
  68.     0x03FC,0x0800,    0x03FC,0x0800,    0x03FC,0x0800,    0x01F8,0x0800,    0x00F8,0x0800,
  69.     0x0000,0x0800,    0x0000,0x0800,    0x0010,0x0800,    0x0008,0x0800,    0x0004,0x0800,
  70.     0x0002,0x0800,    0x0001,0x0800,    0x0000,0x8800,    0x0000,0x4800,    0x0000,0x0800,
  71.     0x0000,0x0000,
  72.     /* BitPlane 1 */
  73.     0xFFFF,0xF800,    0x7F07,0xF800,    0x7FFB,0xF800,    0x7FFD,0xF800,    0x7FFD,0xF800,
  74.     0x7FFD,0xF800,    0x7FFD,0xF800,    0x7FFD,0xF800,    0x7FFB,0xF800,    0x7FFF,0xF800,
  75.     0x7FFF,0xF800,    0x7FDF,0xF800,    0x7FBF,0xF800,    0x7F7F,0xF800,    0x7EFF,0xF800,
  76.     0x7DFF,0xF800,    0x7BFF,0xF800,    0x77FF,0xF800,    0x6000,0x7800,    0x7FFF,0xF800,
  77.     0x8000,0x0800,
  78.     /* BitPlane 2 */
  79.     0x0000,0x0000,    0x80F8,0x0000,    0x80FC,0x0000,    0x81FE,0x0000,    0x81FE,0x0000,
  80.     0x81FE,0x0000,    0x81FE,0x0000,    0x81FE,0x0000,    0x80FC,0x0000,    0x8000,0x0000,
  81.     0x8000,0x0000,    0x8020,0x0000,    0x8040,0x0000,    0x8080,0x0000,    0x8100,0x0000,
  82.     0x8200,0x0000,    0x8400,0x0000,    0x8800,0x0000,    0x9FFF,0x8000,    0x8000,0x0000,
  83.     0x7FFF,0xF000,
  84.     /* BitPlane 3 */
  85.     0x0000,0x0000,    0x0000,0x0000,    0x00F8,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,
  86.     0x01FC,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,    0x00F8,0x0000,    0x0000,0x0000,
  87.     0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,
  88.     0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,
  89.     0x0000,0x0000
  90. };
  91.  
  92. UWORD WKnightData[168] = {
  93.     /* BitPlane 0 */
  94.     0x8000,0x0800,    0xFFFF,0xF000,    0xF000,0x3000,    0xFFFF,0x7000,    0xFFFE,0xF000,
  95.     0xFFFD,0xF000,    0xFFFB,0xF000,    0xFFF7,0xF000,    0xFFEF,0xF000,    0xFFDF,0xF000,
  96.     0xFFFF,0xF000,    0xFFFF,0xF000,    0xFEFF,0xF000,    0xFDFF,0xF000,    0xFDFF,0xF000,
  97.     0xFDFF,0xF000,    0xFDFF,0xF000,    0xFDFF,0xF000,    0xFEFF,0xF000,    0xFF07,0xF000,
  98.     0xFFFF,0xF800,
  99.     /* BitPlane 1 */
  100.     0x7FFF,0xF000,    0x8000,0x0800,    0x9FFF,0xC800,    0x8800,0x8800,    0x8401,0x0800,
  101.     0x8202,0x0800,    0x8104,0x0800,    0x8088,0x0800,    0x8050,0x0800,    0x8020,0x0800,
  102.     0x8000,0x0800,    0x80F8,0x0800,    0x81FC,0x0800,    0x83FE,0x0800,    0x83FE,0x0800,
  103.     0x83FE,0x0800,    0x83FE,0x0800,    0x83FE,0x0800,    0x81FC,0x0800,    0x80F8,0x0800,
  104.     0x7FFF,0xF000,
  105.     /* BitPlane 2 */
  106.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  107.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  108.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  109.     0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,    0xFFFF,0xF800,
  110.     0xFFFF,0xF800,
  111.     /* BitPlane 3 */
  112.     0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,
  113.     0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,    0x0000,0x0000,
  114.     0x0000,0x0000,    0x0000,0x0000,    0x00F8,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,
  115.     0x01FC,0x0000,    0x01FC,0x0000,    0x01FC,0x0000,    0x00F8,0x0000,    0x0000,0x0000,
  116.     0x0000,0x0000
  117. };
  118.  
  119. UWORD BlendFrageData[20] = {
  120.     /* BitPlane 0 */
  121.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  122.     /* BitPlane 1 */
  123.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  124.     /* BitPlane 2 */
  125.     0x8800, 0x6000, 0xC800,    0xF800, 0xC800,
  126.     /* BitPlane 3 */
  127.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800
  128. };
  129.  
  130. UWORD Blend1Data[20] = {
  131.     /* BitPlane 0 */
  132.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  133.     /* BitPlane 1 */
  134.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  135.     /* BitPlane 2 */
  136.     0xD800, 0x9800, 0xD800,    0xD800, 0x8800,
  137.     /* BitPlane 3 */
  138.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800
  139. };
  140.  
  141. UWORD Blend2Data[20] = {
  142.     /* BitPlane 0 */
  143.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  144.     /* BitPlane 1 */
  145.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  146.     /* BitPlane 2 */
  147.     0x8800, 0x6000, 0xC800,    0x9800, 0x0000,
  148.     /* BitPlane 3 */
  149.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800
  150. };
  151.  
  152. UWORD Blend3Data[20] = {
  153.     /* BitPlane 0 */
  154.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  155.     /* BitPlane 1 */
  156.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  157.     /* BitPlane 2 */
  158.     0x8800, 0x6000, 0xC800,    0x6000, 0x8800,
  159.     /* BitPlane 3 */
  160.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800
  161. };
  162.  
  163. UWORD Blend4Data[20] = {
  164.     /* BitPlane 0 */
  165.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  166.     /* BitPlane 1 */
  167.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  168.     /* BitPlane 2 */
  169.     0xE800, 0xC800, 0xA800,    0x0000, 0xE800,
  170.     /* BitPlane 3 */
  171.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800
  172. };
  173.  
  174. UWORD SetFrageData[20] = {
  175.     /* BitPlane 0 */
  176.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  177.     /* BitPlane 1 */
  178.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  179.     /* BitPlane 2 */
  180.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  181.     /* BitPlane 3 */
  182.     0x8800, 0x6000, 0xC800,    0xF800, 0xC800
  183. };
  184.  
  185. UWORD Set1Data[20] = {
  186.     /* BitPlane 0 */
  187.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  188.     /* BitPlane 1 */
  189.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  190.     /* BitPlane 2 */
  191.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  192.     /* BitPlane 3 */
  193.     0xD800, 0x9800, 0xD800,    0xD800, 0x8800
  194. };
  195.  
  196. UWORD Set2Data[20] = {
  197.     /* BitPlane 0 */
  198.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  199.     /* BitPlane 1 */
  200.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  201.     /* BitPlane 2 */
  202.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  203.     /* BitPlane 3 */
  204.     0x8800, 0x6000, 0xC800,    0x9800, 0x0000
  205. };
  206.  
  207. UWORD Set3Data[20] = {
  208.     /* BitPlane 0 */
  209.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  210.     /* BitPlane 1 */
  211.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  212.     /* BitPlane 2 */
  213.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  214.     /* BitPlane 3 */
  215.     0x8800, 0x6000, 0xC800,    0x6000, 0x8800
  216. };
  217.  
  218. UWORD Set4Data[20] = {
  219.     /* BitPlane 0 */
  220.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  221.     /* BitPlane 1 */
  222.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  223.     /* BitPlane 2 */
  224.     0xF800, 0xF800, 0xF800,    0xF800, 0xF800,
  225.     /* BitPlane 3 */
  226.     0xE800, 0xC800, 0xA800,    0x0000, 0xE800
  227. };
  228.  
  229. struct Image Blend[5] =
  230. {
  231.    {    0, 0,    5, 5, 4,    &BlendFrageData[0],    0x0F, 0x00,    NULL },
  232.    {    0, 0,    5, 5, 4,    &Blend1Data[0],    0x0F, 0x00,    NULL },
  233.    {    0, 0,    5, 5, 4,    &Blend2Data[0],    0x0F, 0x00,    NULL },
  234.    {    0, 0,    5, 5, 4,    &Blend3Data[0],    0x0F, 0x00,    NULL },
  235.    {    0, 0,    5, 5, 4,    &Blend4Data[0],    0x0F, 0x00,    NULL }
  236. };
  237.  
  238. struct Image Set[5] =
  239. {
  240.    {    0, 0,    5, 5, 4,    &SetFrageData[0],    0x0F, 0x00,    NULL },
  241.    {    0, 0,    5, 5, 4,    &Set1Data[0],    0x0F, 0x00,    NULL },
  242.    {    0, 0,    5, 5, 4,    &Set2Data[0],    0x0F, 0x00,    NULL },
  243.    {    0, 0,    5, 5, 4,    &Set3Data[0],    0x0F, 0x00,    NULL },
  244.    {    0, 0,    5, 5, 4,    &Set4Data[0],    0x0F, 0x00,    NULL }
  245. };
  246.  
  247. struct Image Pieces[4] =
  248. {
  249.    {    0, 0,    21, 21, 4,    &RKingData[0],    0x0F, 0x00,    NULL },
  250.    {    0, 0,    21, 21, 4,    &WKingData[0],    0x0F, 0x00,    NULL },
  251.    {    0, 0,    21, 21, 4,    &RKnightData[0],    0x0F, 0x00,    NULL },
  252.    {    0, 0,    21, 21, 4,    &WKnightData[0],    0x0F, 0x00,    NULL }
  253. };
  254.  
  255. /* Ende der Images-Definitionen */
  256.  
  257. void DrawRect(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
  258.      ULONG toy)
  259. {
  260.    SetAPen(RP,Color);
  261.    SetDrMd(RP,DrMd);
  262.    Move(RP,fromx,fromy);
  263.    Draw(RP,tox,fromy);
  264.    Draw(RP,tox,toy);
  265.    Draw(RP,fromx,toy);
  266.    Draw(RP,fromx,fromy);
  267. }
  268.  
  269. void DrawLine(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
  270.      ULONG toy)
  271. {
  272.    SetAPen(RP,Color);
  273.    SetDrMd(RP,DrMd);
  274.    Move(RP,fromx,fromy);
  275.    Draw(RP,tox,toy);
  276. }
  277.  
  278. void FillRect(ULONG Color, ULONG fromx, ULONG fromy, ULONG tox, ULONG toy)
  279. {
  280.    SetAPen(RP,Color);
  281.    SetDrMd(RP,JAM1);
  282.    RectFill(RP,fromx,fromy,tox,toy);
  283. }
  284.  
  285. void DrawText(ULONG Color, ULONG DrMd, ULONG x, ULONG y, char *string)
  286. {
  287.    int len;
  288.    SetAPen(RP,Color);
  289.    SetDrMd(RP,DrMd);
  290.    len = strlen(string);
  291.    Move(RP, x, y+7);
  292.    Text(RP, string, len);
  293. }
  294.  
  295. void drawboard(void)
  296. {
  297.    int i,j,col=0;
  298.    DrawRect(6, JAM1, 0, 11, 187, 198);
  299.    DrawRect(5, JAM1, 1, 12, 186, 197);
  300.    for (i=2;i<=164;i+=23)
  301.    {
  302.       DrawLine(14,JAM1,i,13,i,196);
  303.       DrawLine(12,JAM1,i+22,13,i+22,196);
  304.    }
  305.    for (i=13;i<=174;i+=23)
  306.    {
  307.       DrawLine(14,JAM1,2,i,185,i);
  308.       DrawLine(12,JAM1,2,i+22,185,i+22);
  309.    }
  310.    for (i=3;i<=164;i+=23)
  311.    {
  312.       col=2-col;     /* Umschalten zwischen den Schachbrettfarben */
  313.       for (j=14;j<=175;j+=23)
  314.       {
  315.          col=2-col;
  316.          FillRect(13+col,i,j,i+20,j+20);
  317.       }
  318.    }
  319. }
  320.  
  321. void drawplayers(char *Name1, char *Name2)
  322. {
  323.    int i,rng[5]={1,0,2,0,1},len;
  324.    for (i=0;i<=4;++i)
  325.    {
  326.       DrawRect(2+rng[i],JAM1,190+i,11+i,319-i,40-i);
  327.       DrawRect(5+rng[i],JAM1,190+i,44+i,319-i,72-i);
  328.    }
  329.    FillRect(13,195,16,314,35);
  330.    FillRect(13,195,49,314,67);
  331.    DrawText(1,JAM1,223,16,"Player 1");
  332.    DrawText(1,JAM1,223,49,"Player 2");
  333.    len = strlen(Name1) * 8;            /* Pixelbreite von Name1 */
  334.    len /= 2;
  335.    DrawText(2,JAM1,255-len,25,Name1);
  336.    len = strlen(Name2) * 8;            /* Pixelbreite von Name2 */
  337.    len /= 2;
  338.    DrawText(5,JAM1,255-len,58,Name2);
  339. }
  340.  
  341. void SetPiece(struct Piece Which, BOOL FadeIn, BOOL StayBlend)
  342. {           /* die beiden BOOLs: Farben hochfahren, Am Ende Farbe 1 setzen ? */
  343.    int xpos,ypos,i;
  344.    BOOL white=FALSE;
  345.    xpos = 3 + 23*Which.x;
  346.    ypos = 14+ 23*Which.y;
  347.    DrawImage(RP,&Pieces[Which.ID],xpos,ypos);
  348.    if (Which.ID % 2) white = TRUE;
  349.    SetRGB4(VP,11,0,0,0);
  350.    DrawImage(RP,&Blend[Which.Value],xpos+8,ypos+(white ? 13 : 3));
  351.    if (FadeIn)
  352.    {
  353.       for (i=1;i<=15;++i)
  354.       {
  355.          SetRGB4(VP,11,i,i,i);
  356.          WaitTOF();
  357.       }
  358.    }
  359.    SetRGB4(VP,11,15,15,15);
  360.    if (!StayBlend) DrawImage(RP,&Set[Which.Value],xpos+8,ypos+(white ? 13 : 3));
  361. }
  362.  
  363. /* vor MovePiece muß SetPiece mit StayBlend == TRUE gesetzt werden, sonst wird
  364.    der Zahlenwert des Steins nicht ausgeblendet. Außerdem darf nur entweder
  365.    xdist ODER ydist != 0 sein !!! (Sonst wird nur xdist beachtet)
  366.    Nach MovePiece muß SetPiece mit StayBlend == FALSE und FadeIn == TRUE
  367.    aufgerufen werden */
  368.  
  369. void MovePiece(UBYTE x, UBYTE y, int xdist, int ydist, BOOL FadeOut)
  370. {
  371.    int xpos,ypos,i,j,fieldcol,sign,brightness=15;
  372.    xpos = 3 + 23*x;
  373.    ypos = 14+ 23*y;
  374.    BltBitMap(BM,xpos,ypos,&PiecesBM,0,0,21,21,0x00c0,0x00ff,NULL);
  375.    if (xdist)
  376.    {
  377.       sign = (xdist>0) ? 1 : -1;
  378.       for (i=0; (xdist>0)? i<xdist: i>xdist; (xdist>0)? ++i: --i)
  379.       {
  380.          if ((x + y) % 2) fieldcol = 15; else fieldcol = 13;
  381.          for (j=0; j!=21*sign; j+=sign)
  382.          {
  383.             xpos+=sign;
  384.             BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  385.             if (sign>0)
  386.                DrawLine(fieldcol,JAM1,xpos-1,ypos,xpos-1,ypos+20);
  387.             else
  388.                DrawLine(fieldcol,JAM1,xpos+21,ypos,xpos+21,ypos+20);
  389.             if (brightness > 0 && FadeOut == TRUE)
  390.             {
  391.                SetRGB4(VP,11,brightness,brightness,brightness);
  392.                --brightness;
  393.             }
  394.             WaitTOF();
  395.          }
  396.          xpos+=sign;
  397.          BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  398.          if (sign>0)
  399.             DrawLine(12,JAM1,xpos-1,ypos,xpos-1,ypos+20);
  400.          else
  401.             DrawLine(14,JAM1,xpos+21,ypos,xpos+21,ypos+20);
  402.          WaitTOF();
  403.          xpos+=sign;
  404.          BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  405.          if (sign>0)
  406.             DrawLine(14,JAM1,xpos-1,ypos,xpos-1,ypos+20);
  407.          else
  408.             DrawLine(12,JAM1,xpos+21,ypos,xpos+21,ypos+20);
  409.          WaitTOF();
  410.          x += sign;
  411.       }
  412.    }
  413.    else /* ydist != 0 */
  414.    {
  415.       sign = (ydist>0) ? 1 : -1;
  416.       for (i=0; (ydist>0)? i<ydist: i>ydist; (ydist>0)? ++i: --i)
  417.       {
  418.          if ((x + y) % 2) fieldcol = 15; else fieldcol = 13;
  419.          for (j=0; j!=21*sign; j+=sign)
  420.          {
  421.             ypos+=sign;
  422.             BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  423.             if (sign>0)
  424.                DrawLine(fieldcol,JAM1,xpos,ypos-1,xpos+20,ypos-1);
  425.             else
  426.                DrawLine(fieldcol,JAM1,xpos,ypos+21,xpos+20,ypos+21);
  427.             if (brightness > 0 && FadeOut == TRUE)
  428.             {
  429.                SetRGB4(VP,11,brightness,brightness,brightness);
  430.                --brightness;
  431.             }
  432.             WaitTOF();
  433.          }
  434.          ypos+=sign;
  435.          BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  436.          if (sign>0)
  437.             DrawLine(12,JAM1,xpos,ypos-1,xpos+20,ypos-1);
  438.          else
  439.             DrawLine(14,JAM1,xpos,ypos+21,xpos+20,ypos+21);
  440.          WaitTOF();
  441.          ypos+=sign;
  442.          BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
  443.          if (sign>0)
  444.             DrawLine(14,JAM1,xpos,ypos-1,xpos+20,ypos-1);
  445.          else
  446.             DrawLine(12,JAM1,xpos,ypos+21,xpos+20,ypos+21);
  447.          WaitTOF();
  448.          y += sign;
  449.       }
  450.    }
  451. }
  452.  
  453. void Highlight(UBYTE x, UBYTE y)
  454. {
  455.    int xpos,ypos;
  456.    xpos = 1 + 23*x;
  457.    ypos = 12+ 23*y;
  458.    DrawRect(1,COMPLEMENT,xpos,ypos,xpos+24,ypos+24);
  459.    DrawRect(1,COMPLEMENT,xpos+1,ypos+1,xpos+23,ypos+23);
  460. }
  461.